# -*- coding:utf-8 -*-
# @FileName  :try_decorate.py
# @Time      :2023/11/16 15:59
# @Author    :lin

import traceback

from mail_distribution import *


def debug(func):
    def wrapper(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except:
            _subject = "程序运行出错"
            _content_text = "请查看程序运行情况\n" + traceback.format_exc()
            traceback.print_exc()
            mail.send_mail(host, _subject, _content_text)

    return wrapper


@debug
def hello(i):
    print(i)


# hello(1)
